<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>base</title>
<!-- css -->
<link id="v_theme" href="../../src/css/theme/aristo/theme.css" rel="stylesheet" type="text/css" />
<link href="../../src/css/primeui-1.1-min.css" rel="stylesheet" type="text/css" />
<!--lib js  -->
<script type="text/javascript" src="../../src/lib/vue.js"></script>
<script type="text/javascript" src="../../src/lib/jquery.min.js"></script>
<!-- js加载器 -->
<script type="text/javascript" src="../../src/loader/loader.js"></script>
<script type="text/javascript" src="../js/theme.js"></script>
<script type="text/javascript" src="gridData.js"></script>

</head>
<body>
<button onclick="checkAll()">checkAll</button>
<button onclick="uncheckAll()">uncheckAll()</button>

<div id="grid"></div>
<hr>
<button onclick="checkAll2()">checkAll</button>
<button onclick="uncheckAll2()">uncheckAll()</button>

<div id="grid2"></div>

<script type="text/javascript">

VUI
.dir('../../src/') // 设置JS存放根目录
.use('Grid',function(){
	grid = new VUI.Grid({
		renderId:'grid'
		,data : gridData
		//,url:'http://localhost:8087/emptyProject/listEasyuiOrderInfo_backuser.do'
		,striped:true // 斑马线
		,pagination :true
		,singleSelect  :true
		// 添加事件方式1
		,onCheck :function(e) {
			console.log('onCheck index:' + e.index + ' mobile:' + e.row.mobile)
		}
		,columns : [ [
			{field:'orderId',checkbox : true} // 勾选
			,{
				field : 'cityName',
				title : '城市'
			},
			{
				field : 'mobile',
				title : '手机号'
			},
			{
				field : 'address',
				title : '地址'
			},
			{
				field : 'createDate',
				title : '创建时间'
			}] 
		]
	});
	
	// 添加事件方式2
	grid.on('Uncheck',function(e){
		console.log('onUnCheck index:' + e.index + ' mobile:' + e.row.mobile)
	})
	
	
	grid2 = new VUI.Grid({
		renderId:'grid2'
		,data : gridData
		,striped:true // 斑马线
		,pagination :true
		//,singleSelect  :true
		// 添加事件方式1
		,onCheck :function(e) {
			console.log('onCheck index:' + e.index + ' mobile:' + e.row.mobile)
		}
		,columns : [ [
			{field:'orderId',checkbox : true} // 勾选
			,{
				field : 'cityName',
				title : '城市'
			},
			{
				field : 'mobile',
				title : '手机号'
			},
			{
				field : 'address',
				title : '地址'
			},
			{
				field : 'createDate',
				title : '创建时间'
			}] 
		]
	});
	
	// 添加事件方式2
	grid2.on('Uncheck',function(e){
		console.log('onUnCheck index:' + e.index + ' mobile:' + e.row.mobile)
	})
});


function uncheckAll(){
	grid.uncheckAll();
}
function checkAll(){
	grid.checkAll();
}
function uncheckAll2(){
	grid2.uncheckAll();
}
function checkAll2(){
	grid2.checkAll();
}
</script>
</body>
</html>